<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:f="http://xmlns.jcp.org/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                template="/WEB-INF/template.xhtml">

    <ui:define name="title">
        Horizontal Tree <span class="subitem">Selection</span>
    </ui:define>

    <ui:define name="description">
        Tree provides three selection modes, "single", "multiple" and "checkbox".
    </ui:define>

    <ui:param name="documentationLink" value="/components/tree?id=horizontal-tree"/>
    <ui:param name="widgetLink" value="HorizontalTree"/>

    <ui:define name="implementation">

        <h:form>
            <p:growl id="msgs" showDetail="true" escape="false"/>

            <div class="card">
                <h5 class="mt-0">Single</h5>
                <p:tree value="#{treeSelectionView.root1}" var="doc" orientation="horizontal"
                        selectionMode="single"
                        selection="#{treeSelectionView.selectedNode}">
                    <p:treeNode expandedIcon="pi pi-folder-open" collapsedIcon="pi pi-folder">
                        <h:outputText value="#{doc.name}"/>
                    </p:treeNode>
                    <p:treeNode type="app" icon="pi pi-save">
                        <h:outputText value="#{doc.name}"/>
                    </p:treeNode>
                    <p:treeNode type="document" icon="pi pi-file">
                        <h:outputText value="#{doc.name}"/>
                    </p:treeNode>
                    <p:treeNode type="excel" icon="pi pi-file-excel">
                        <h:outputText value="#{doc.name}"/>
                    </p:treeNode>
                    <p:treeNode type="travel" icon="pi pi-file-pdf">
                        <h:outputText value="#{doc.name}"/>
                    </p:treeNode>
                    <p:treeNode type="picture" icon="pi pi-image">
                        <h:outputText value="#{doc.name}"/>
                    </p:treeNode>
                    <p:treeNode type="video" icon="pi pi-video">
                        <h:outputText value="#{doc.name}"/>
                    </p:treeNode>
                </p:tree>

                <p:commandButton value="Display" update="msgs" icon="pi pi-clone" styleClass="mt-3"
                                 action="#{treeSelectionView.displaySelectedSingle}"/>
            </div>

            <div class="card">
                <h5>Multiple with metakey</h5>
                <p:tree value="#{treeSelectionView.root2}" var="doc" orientation="horizontal"
                        selectionMode="multiple"
                        selection="#{treeSelectionView.selectedNodes1}">
                    <p:treeNode expandedIcon="pi pi-folder-open" collapsedIcon="pi pi-folder">
                        <h:outputText value="#{doc.name}"/>
                    </p:treeNode>
                    <p:treeNode type="app" icon="pi pi-save">
                        <h:outputText value="#{doc.name}"/>
                    </p:treeNode>
                    <p:treeNode type="document" icon="pi pi-file">
                        <h:outputText value="#{doc.name}"/>
                    </p:treeNode>
                    <p:treeNode type="excel" icon="pi pi-file-excel">
                        <h:outputText value="#{doc.name}"/>
                    </p:treeNode>
                    <p:treeNode type="travel" icon="pi pi-file-pdf">
                        <h:outputText value="#{doc.name}"/>
                    </p:treeNode>
                    <p:treeNode type="picture" icon="pi pi-image">
                        <h:outputText value="#{doc.name}"/>
                    </p:treeNode>
                    <p:treeNode type="video" icon="pi pi-video">
                        <h:outputText value="#{doc.name}"/>
                    </p:treeNode>
                </p:tree>

                <p:commandButton value="Display" update="msgs" icon="pi pi-clone" styleClass="mt-3"
                                 action="#{treeSelectionView.displaySelectedMultiple(treeSelectionView.selectedNodes1)}"/>
            </div>

            <div class="card">
                <h5>Checkbox</h5>
                <p:tree value="#{treeSelectionView.root3}" var="doc" orientation="horizontal"
                        selectionMode="checkbox"
                        selection="#{treeSelectionView.selectedNodes2}">
                    <p:treeNode expandedIcon="pi pi-folder-open" collapsedIcon="pi pi-folder">
                        <h:outputText value="#{doc.name}"/>
                    </p:treeNode>
                    <p:treeNode type="app" icon="pi pi-save">
                        <h:outputText value="#{doc.name}"/>
                    </p:treeNode>
                    <p:treeNode type="document" icon="pi pi-file">
                        <h:outputText value="#{doc.name}"/>
                    </p:treeNode>
                    <p:treeNode type="excel" icon="pi pi-file-excel">
                        <h:outputText value="#{doc.name}"/>
                    </p:treeNode>
                    <p:treeNode type="travel" icon="pi pi-file-pdf">
                        <h:outputText value="#{doc.name}"/>
                    </p:treeNode>
                    <p:treeNode type="picture" icon="pi pi-image">
                        <h:outputText value="#{doc.name}"/>
                    </p:treeNode>
                    <p:treeNode type="video" icon="pi pi-video">
                        <h:outputText value="#{doc.name}"/>
                    </p:treeNode>
                </p:tree>

                <p:commandButton value="Display" update="msgs" icon="pi pi-clone" styleClass="mt-3"
                                 action="#{treeSelectionView.displaySelectedMultiple(treeSelectionView.selectedNodes2)}"/>
            </div>

        </h:form>

    </ui:define>

</ui:composition>
